<? $category_url = $this->category ? $this->category . '/' : ''; ?>
<? $letter = false; $i = 0; $column = 1; $set_delim = false; $delim = (count($this->marks) - count($this->marks) % 4) / 4;?>

<div data-role="header">
		<h1>Каталог авто по маркам</h1>
	</div><!-- /header -->

	<div data-role="content" class="ui-scrolllistview">
			<ul data-role="listview" data-filter="true">
				<? foreach ($this->marks as $mark): ?>
                <? if ($i % $delim == 0 && $i > 0 && $column < 4) {
                    $set_delim = true;
                } ?>
                <? //detect new first character of string ?>
                <? if (mb_substr($mark['name'], 0, 1, 'UTF-8') != $letter) {
                    $letter = mb_substr($mark['name'], 0, 1, 'UTF-8');
                    print '<li data-role="list-divider"><b>'.$letter.'</b>';
                    print "<li><a href='/catalog/".$category_url.$mark['name']."'>". $mark["name"] ."</a><span class='ui-li-count'>".$mark['count']."</span></li>";
                    $i++;
                    continue;
                } ?>
				<li><a href="/catalog/<?=$category_url . $mark['name'] ?>"><?=$mark['name'] ?></a><span class="ui-li-count"><?= $mark['count'] ?></span></li>
				<? $i++; ?>
                <? endforeach; ?>
			</ul>
	</div><!-- /content -->



	<div data-role="footer"  class="nav-glyphish-example">
		<div data-role="navbar" class="nav-glyphish-example" data-grid="d">
			<ul>
				    <? foreach($this->categories as $k=>$category):?>
				        <li><a id="cat_<?=$category['id'] ?>" data-icon="custom" class="<? if($this->category_id == $category['id'])print 'ui-btn-active'; ?>" href="/catalog/<?= $category['rewrite'] ?>"><?= $category['name']; ?></a></li>
				        <?php if($k>2)break;?>
				    <? endforeach; ?>
                <li>
                    <li><a href="/catalog/audi/" data-rel="dialog" data-transition="slideup" data-icon="gear" class="<? if($this->category_id == $category['id'])print 'ui-btn-active'; ?>" href="/catalog/<?= $category['rewrite'] ?>"><?= $category['name']; ?></a></li>

                </li>
			</ul>
		</div>
	</div>
<!-- aaa-->
